from requests import sessions

from commons.global_info import base_url, dict_var
from utils.encrypt_tool import md5_data


class Login:
    """登录模块"""

    def user_login(self, method, url, **kwargs):
        url = f"{base_url}{url}"
        method = method
        # print(url,method,kwargs)
        response = sessions.Session().request(method, url, **kwargs)
        return response


if __name__ == '__main__':
    login_obj = Login()
    res=login_obj.user_login(
        "POST",
        "/auth/oauth/token",
        params={
            "grant_type": "password",
            "client_id": "HHIKARr5Tx2cek4O",
            "username": "15732069727",
            "password": md5_data("q123456")
        })
    print(res)